set(CMAKE_CXX_STANDARD 17)
set(EXECUTABLE_NAME DicomToolsTest)

find_package(GTest CONFIG REQUIRED PATHS "F:/ci/CI_HOME/ci_cache/windows_x86_64_msvc16_md/GTest-1.12.1-static")

add_executable(${EXECUTABLE_NAME})

target_sources(
    ${EXECUTABLE_NAME}
    PRIVATE
    ${CMAKE_CURRENT_LIST_DIR}/TestDicomTools.cpp
)

target_link_libraries(${EXECUTABLE_NAME}
    PRIVATE
        GTest::gtest
        GTest::gtest_main
        DicomTools
)

add_custom_command(
    TARGET ${EXECUTABLE_NAME}
    POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:DicomTools> $<TARGET_FILE_DIR:${EXECUTABLE_NAME}>
)

add_test(NAME ${EXECUTABLE_NAME} COMMAND ${EXECUTABLE_NAME})
set_tests_properties(${EXECUTABLE_NAME} PROPERTIES WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test)
